using QAssetBundle;
using UnityEngine;
using QFramework;
using NotImplementedException = System.NotImplementedException;

namespace ProjectSurvival
{
	public partial class MyHp : PowerUp
	{
		private Collider2D _collider;

		private void Awake()
		{
			_collider = GetComponent<Collider2D>();
		}
		void Start()
		{
			gameObject.OnTriggerEnter2DEvent((other) =>
			{
				if (other.GetComponent<CollectableArea>())
				{
					if (Global.Hp.Value==Global.MaxHp.Value)
					{
						
					}
					else
					{
						FlyToPlayer = true;
					}
				}
			}).UnRegisterWhenGameObjectDestroyed(gameObject);
		}

		protected override Collider2D Collider => _collider;
		protected override void Execute()
		{
			AudioKit.PlaySound(Hp_wav.HP);
			Global.Hp.Value++;
			gameObject.DestroySelfGracefully();	
		}
	}
}
